<?php

// Include
include_once('include/header.php');
include_once('plugin/PlanesDBPlugin.php');
include_once('plugin/FotosDBPlugin.php');

// Ejecucion
$planes = PlanesDBPlugin::getPlanesPublished();


// Obtengo el idplan
$idplan = null;
if (isset($_GET[idplan]) && $_GET[idplan] != "") {
	$idplan = $_GET[idplan];
} else {
	$idplan = $planes[0][idplan];
}


// Obtengo el plan
$plan = PlanesDBPlugin::getById($idplan);
$fotos = PlanesDBPlugin::getImages($idplan, "foto");
$planos = PlanesDBPlugin::getImages($idplan, "plano");


// Smarty call
$smarty->assign('planes', $planes);
$smarty->assign('plan', $plan);
$smarty->assign('idplan', $idplan);
$smarty->assign('fotos', $fotos);
$smarty->assign('planos', $planos);
$smarty->assign('option', basename($_SERVER['PHP_SELF']));
$smarty->display('preventa.tpl');

?>